package com.gateway.video.rtsp.stream.pull;

import lombok.RequiredArgsConstructor;
import lombok.var;
import org.springframework.beans.factory.InitializingBean;

import java.util.ServiceLoader;

@RequiredArgsConstructor
public class PullStart implements InitializingBean {
    private final PullVideoConfig pullVideoConfig;

    @Override
    public void afterPropertiesSet() throws Exception {
        var iterator = ServiceLoader.load(PullVideoStream.class).iterator();
        while (iterator.hasNext()) {
            var next = iterator.next();
            next.pull(pullVideoConfig);
        }
    }
}
